package com.ikun.aimian.model.vo;

import com.ikun.aimian.model.entity.InterviewPost;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.util.Date;

/**
 * 面试经历帖子展示对象
 */
@Data
public class InterviewPostVO implements Serializable {
    private Long id;
    private Long userId;
    private String title;
    private String difficulty;
    private String content;
    private Date createTime;
    private Date updateTime;

    /**
     * 发帖人信息
     */
    private UserVO user;

    /**
     * 实体转 VO
     */
    public static InterviewPostVO objToVo(InterviewPost post) {
        if (post == null) return null;
        InterviewPostVO vo = new InterviewPostVO();
        BeanUtils.copyProperties(post, vo);
        return vo;
    }

    /**
     * VO 转实体
     */
    public static InterviewPost voToObj(InterviewPostVO vo) {
        if (vo == null) return null;
        InterviewPost post = new InterviewPost();
        BeanUtils.copyProperties(vo, post);
        return post;
    }
}
